package network.themis.rms.console.rest;

import network.themis.rms.console.common.model.FileVO;
import network.themis.rms.console.common.model.RestResp;
import network.themis.rms.console.entity.biz.NewsTipVO;
import network.themis.rms.console.service.NewsService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author ccl
 * @time 2018-07-20 13:33
 * @name BannerController
 * @desc:
 */

@RestController
@RequestMapping(value = "/news")
public class NewsController {

    @Resource
    private NewsService newsService;

    @PostMapping(value = "/tips/add")
    public RestResp addNewsTip(@RequestBody NewsTipVO vo){
        return newsService.saveNewsTip(vo);
    }

    @DeleteMapping (value = "/tips/delete/{id}")
    public RestResp removeNewsTip(@PathVariable Long id){
        return newsService.removeNewsTip(id);
    }

    @RequestMapping (value = "/banner/add")
    public RestResp removeNewsTip(@ModelAttribute FileVO vo){
        return newsService.addBannerTip(vo);
    }

    @DeleteMapping (value = "/banner/delete/{id}")
    public RestResp removeBannerTip(@PathVariable Long id){
        return newsService.removeBannerTip(id);
    }
}
